package com.geor.gcv.core.util;

import org.nutz.lang.Stopwatch;
import org.nutz.log.Loggers;
import org.slf4j.Logger;

/**
 * 计算耗时
 * 
 * @author geor.lusongnan
 *
 */
public abstract class TimeConsum {
	Logger log = Loggers.get();
	private String mess = "Time consuming";

	public TimeConsum() {
	}

	public TimeConsum(String mess) {
		this.mess = mess;
	}

	public void start() {
		Stopwatch sw = Stopwatch.begin();
		comsum();
		sw.stop();
		log.info(String.format("%s : %d", mess, sw.getDuration()));
	}

	protected abstract void comsum();
	
	
	public static void main(String[] args) {
		new TimeConsum() {
			@Override
			protected void comsum() {
				
			}
		};
	}

}
